﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using System.Diagnostics;

namespace Enterprise.Management.Common
{
    public class Log
    {
        public static void Info(string message)
        {
            Write(message, TraceEventType.Information);
        }

        public static void Error(string message)
        {
            Write(message, TraceEventType.Error);
        }

        public static void Error(Exception ex)
        {
            Write(ex.Message + "" + ex.StackTrace.ToString(), TraceEventType.Error);
        }

        private static void Write(string message, TraceEventType type)
        {
            LogEntry logEntry = new LogEntry();
            logEntry.Message = message;
            logEntry.Severity = type;
            Logger.Writer.Write(logEntry);
        }
    }
}